import { getStream } from '../Core/connect'
import { Object3D } from './Object3D'

export class Emitter extends Object3D {
    readonly type: string
    constructor(name: string) {
        super({name: name, type: 'Emitter'})
        this.type = 'Emitter'
    }

    setFireRate(fireRate: number) {
        const stream = getStream()
        const str = {emitterFunction: 'setFireRate', ids: `${this.uuid}`, fireRate: fireRate}
        stream.emitUIInteraction(str)
    }
    setSmokeRate(smokeRate: number) {
        const stream = getStream()
        const str = {emitterFunction: 'setSmokeRate', ids: `${this.uuid}`, smokeRate: smokeRate}
        stream.emitUIInteraction(str)
    }
    setFireSizeMin(fireSizeMin: number) {
        const stream = getStream()
        const str = {emitterFunction: 'setFireSizeMin', ids: `${this.uuid}`, fireSizeMin: fireSizeMin}
        stream.emitUIInteraction(str)
    }

    setSmokeSizeMin(smokeSizeMin: number) {
        const stream = getStream()
        const str = {emitterFunction: 'setSmokeSizeMin', ids: `${this.uuid}`, smokeSizeMin: smokeSizeMin}
        stream.emitUIInteraction(str)
    }

    setFireSizeMax(fireSizeMax: number) {
        const stream = getStream()
        const str = {emitterFunction: 'setFireSizeMax', ids: `${this.uuid}`, fireSizeMax: fireSizeMax}
        stream.emitUIInteraction(str)
    }

    setSmokeSizeMax(smokeSizeMax: number) {
        const stream = getStream()
        const str = {emitterFunction: 'setSmokeSizeMax', ids: `${this.uuid}`, smokeSizeMax: smokeSizeMax}
        stream.emitUIInteraction(str)
    }

    setFireMinVelocitySpeed(fireMinVelocitySpeed: number) {
        const stream = getStream()
        const str = {emitterFunction: 'setFireMinVelocitySpeed', ids: `${this.uuid}`, fireMinVelocitySpeed: fireMinVelocitySpeed}
        stream.emitUIInteraction(str)
    }

    setSmokeMinVelocitySpeed(smokeMinVelocitySpeed: number) {
        const stream = getStream()
        const str = {emitterFunction: 'setSmokeMinVelocitySpeed', ids: `${this.uuid}`, smokeMinVelocitySpeed: smokeMinVelocitySpeed}
        stream.emitUIInteraction(str)
    }

    setFireMaxVelocitySpeed(fireMaxVelocitySpeed: number) {
        const stream = getStream()
        const str = {emitterFunction: 'setFireMaxVelocitySpeed', ids: `${this.uuid}`, fireMaxVelocitySpeed: fireMaxVelocitySpeed}
        stream.emitUIInteraction(str)
    }

    setSmokeMaxVelocitySpeed(smokeMaxVelocitySpeed: number) {
        const stream = getStream()
        const str = {emitterFunction: 'setSmokeMaxVelocitySpeed', ids: `${this.uuid}`, smokeMaxVelocitySpeed: smokeMaxVelocitySpeed}
        stream.emitUIInteraction(str)
    }
}

